home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / FunTetris / funtetris.jar / gratest / TetElements.class (.txt) next >
Encoding:
Java Class File  |  2002-05-20  |  3.1 KB  |  113 lines

  1. package gratest;
  2.  
  3. public class TetElements {
  4.    public int iNumBlocs;
  5.    public int iNumRotations;
  6.    public int iNoRotConstraints = 1;
  7.    public int[][] blockPositions;
  8.    public int[][] bottomConstraints;
  9.    public int[][] leftConstraints;
  10.    public int[][] rightConstraints;
  11.    public int[][] rotMove;
  12.    public int[][] rotConstraints;
  13.  
  14.    public TetElements(int i, int j) {
  15.       this.iNumBlocs = i;
  16.       this.iNumRotations = j;
  17.       this.blockPositions = new int[j][i];
  18.       this.bottomConstraints = new int[j][6];
  19.       this.leftConstraints = new int[j][6];
  20.       this.rightConstraints = new int[j][6];
  21.       this.rotMove = new int[j][2];
  22.       this.rotConstraints = new int[j][];
  23.  
  24.       for(int k = 0; k < j; ++k) {
  25.          this.rotMove[k][0] = -10;
  26.          this.rotMove[k][1] = -10;
  27.       }
  28.  
  29.    }
  30.  
  31.    public void SetPosition(int i, int j, int value) {
  32.       this.blockPositions[i][j] = value;
  33.    }
  34.  
  35.    public int GetPosition(int i, int j) {
  36.       return this.blockPositions[i][j];
  37.    }
  38.  
  39.    public void SetBottomConstraintValues(int i, int nElem, int e1, int e2, int e3, int e4, int e5) {
  40.       this.bottomConstraints[i][0] = nElem;
  41.       this.bottomConstraints[i][1] = e1;
  42.       this.bottomConstraints[i][2] = e2;
  43.       this.bottomConstraints[i][3] = e3;
  44.       this.bottomConstraints[i][4] = e4;
  45.       this.bottomConstraints[i][5] = e5;
  46.    }
  47.  
  48.    public void SetBottomConstraintValue(int i, int j, int value) {
  49.       this.bottomConstraints[i][j] = value;
  50.    }
  51.  
  52.    public int GetBottomConstraintValue(int i, int j) {
  53.       return this.bottomConstraints[i][j];
  54.    }
  55.  
  56.    public void SetLeftConstraintValue(int i, int j, int value) {
  57.       this.leftConstraints[i][j] = value;
  58.    }
  59.  
  60.    public void SetLeftConstraintValues(int i, int nElem, int e1, int e2, int e3, int e4, int e5) {
  61.       this.leftConstraints[i][0] = nElem;
  62.       this.leftConstraints[i][1] = e1;
  63.       this.leftConstraints[i][2] = e2;
  64.       this.leftConstraints[i][3] = e3;
  65.       this.leftConstraints[i][4] = e4;
  66.       this.leftConstraints[i][5] = e5;
  67.    }
  68.  
  69.    public int GetLeftConstraintValue(int i, int j) {
  70.       return this.leftConstraints[i][j];
  71.    }
  72.  
  73.    public void SetRightConstraintValue(int i, int j, int value) {
  74.       this.rightConstraints[i][j] = value;
  75.    }
  76.  
  77.    public void SetRightConstraintValues(int i, int nElem, int e1, int e2, int e3, int e4, int e5) {
  78.       this.rightConstraints[i][0] = nElem;
  79.       this.rightConstraints[i][1] = e1;
  80.       this.rightConstraints[i][2] = e2;
  81.       this.rightConstraints[i][3] = e3;
  82.       this.rightConstraints[i][4] = e4;
  83.       this.rightConstraints[i][5] = e5;
  84.    }
  85.  
  86.    public int GetRightConstraintValue(int i, int j) {
  87.       return this.rightConstraints[i][j];
  88.    }
  89.  
  90.    public void SetRotMove(int i, int x, int y) {
  91.       this.rotMove[i][0] = x;
  92.       this.rotMove[i][1] = y;
  93.    }
  94.  
  95.    public void SetRotConstraintValues(int i, int iStart, int e0, int e1, int e2, int e3, int e4, int e5) {
  96.       this.iNoRotConstraints = 0;
  97.       if (iStart == 0) {
  98.          this.rotConstraints[i] = new int[(e0 + 5) / 5 * 5 + 3];
  99.       }
  100.  
  101.       this.rotConstraints[i][iStart] = e0;
  102.       this.rotConstraints[i][iStart + 1] = e1;
  103.       this.rotConstraints[i][iStart + 2] = e2;
  104.       this.rotConstraints[i][iStart + 3] = e3;
  105.       this.rotConstraints[i][iStart + 4] = e4;
  106.       this.rotConstraints[i][iStart + 5] = e5;
  107.    }
  108.  
  109.    public int GetRotConstraintValue(int i, int j) {
  110.       return this.rotConstraints[i][j];
  111.    }
  112. }
  113.